<template>
  <div>
    <a-card>
      <a-row style="margin-bottom: 10px">
        <a-col :span="24"  style="display: flex;flex-direction: row-reverse">
          <a-button v-print="'#printReport'" type="primary">打印报表</a-button>
        </a-col>
      </a-row>
      <div id="printReport">
        <table border="1" cellPadding="5" cellSpacing="0" bordercolor="#000" style="width: 100%;margin-top: 10px">
          <tr>
            <th colSpan="7">
              <div style="position: relative;text-align: center">
                <img src="@/assets/reportIcon.png" width="100px" height="30px" style="position: absolute;left: 0px;top:-5px"/>
                <span>SMT首件确认表</span>
              </div>
            </th>
          </tr>
          <tr>
            <td style="width: 14%"rowspan="5" align="center">基本信息</td>
            <td style="width: 14%">线别</td>
            <td style="width: 14%">{{reportData.lineType}}</td>
            <td style="width: 14%">日期/班别</td>
            <td style="width: 14%">{{reportData.createTime}}</td>
            <td style="width: 14%">客户名称</td>
            <td>{{reportData.customerName}}</td>
          </tr>
          <tr>
            <td>产品名称</td>
            <td>{{reportData.productName}}</td>
            <td>软件版本</td>
            <td>{{reportData.softwareVersion}}</td>
            <td>生产任务单</td>
            <td>{{reportData.productNum}}</td>
          </tr>
          <tr>
            <td>BOM</td>
            <td>{{reportData.productBom}}</td>
            <td>芯片型号</td>
            <td>{{reportData.chipType}}</td>
            <td>LED灯颜色</td>
            <td>{{reportData.ledColor}}</td>
          </tr>
          <tr>
            <td>批量/样本数</td>
            <td>{{reportData.samplesNum}}</td>
            <td>PCB周期/版本</td>
            <td>{{reportData.pcbCycle}}</td>
            <td>工艺要求</td>
            <td>
              <div style="display: flex;pointer-events: none;">
                <a-radio-group v-model="reportData.techReq" :options="checkedList"/>
              </div>
            </td>
          </tr>
          <tr>
            <td>首件类型</td>
            <td colspan="5">
              <div style="display:flex;flex-wrap: wrap;pointer-events: none;">
                <a-checkbox-group v-model="firstType" :options="firstList"/>
              </div>
            </td>
          </tr>
          <tr>
            <td :rowspan="reportData.firstPieceSmtlogs.length+1" align="center">查验内容</td>
            <td align="center">检查项目</td>
            <td colspan="2" align="center">检验记录</td>
            <td colspan="3" align="center">不良成因分析/对策</td>
          </tr>
          <tr v-for="item in reportData.firstPieceSmtlogs">
            <td>{{item.insItem}}</td>
            <td colspan="2">{{item.insLog}}</td>
            <td colspan="3">{{item.badCauses}}</td>
          </tr>
          <tr>
            <td align="center">判断结果</td>
            <td colspan="6">
              <div style="pointer-events: none;">
                <a-radio-group v-model="reportData.judgeResult" :options="hglist"/>
              </div>
              <div>
                <a-row>
                  <a-col :span="12">技术工程：{{reportData.query2}}</a-col>
                  <a-col :span="12">生产代表：{{reportData.query3}}</a-col>
                </a-row>
                <a-row>
                  <a-col :span="12">品质代表：{{reportData.query4}}</a-col>
                  <a-col :span="12">客户代表：</a-col>
                </a-row>
              </div>
            </td>
          </tr>
        </table>
        <div style="display: flex;justify-content: space-between">
          <div>文件编号:YZY-QRQC-090</div>
          <div>版本:3</div>
          <div>保密等级:一般</div>
          <div>使用形式:纸质档</div>
          <div>保存期限:2年</div>
          <div>销毁方式:双面使用</div>
        </div>
      </div>
    </a-card>
  </div>
</template>

<script>
export default {
  /** SMT首件确认表 **/
  name: 'SMTFirstInspectionConfirm',
  props:{
    reportData:{
      type:Object,
      default:()=>{}
    }
  },
  watch:{
    reportData:{
      handler(newVal,oldVal){
        this.firstType = this.reportData.firstType.split(",")
      }
    }
  },
  data(){
    return {
      checkedList:[
        { label: '有铅', value: '有铅' },
        { label: '无铅', value: '无铅' },
        { label: '红胶', value: '红胶' },
      ],
      firstList:[
        { label: '每班首件', value: '每班首件' },
        { label: '转线(机型)', value: '转线(机型)' },
        { label: '新机试产', value: '新机试产' },
        { label: '软件变更', value: '软件变更' },
        { label: '调机(印刷、贴片)', value: '调机(印刷、贴片)' },
        { label: '程序变更', value: '程序变更' },
        { label: '回流焊曲线变更', value: '回流焊曲线变更' },
        { label: '物料变更(主/辅料)', value: '物料变更(主/辅料)' },
        { label: '设计变更', value: '设计变更' },
        { label: '重大工艺变更', value: '重大工艺变更' },
        { label: '反工', value: '反工' },
      ],
      hglist:[
        { label: '合格 可生产', value: '合格' },
        { label: '不合格 暂停生产', value: '不合格' },
      ],
      firstType:[],
    }
  }
}
</script>

<style scoped>

</style>